<!--<div class="page-header">
    <h3 class="remove-line-height">Welcome <?php echo $authuser['fname'].' '.$authuser['mname'].' '.$authuser['lname']?> !</h3>
</div>-->

<style>
    .table-small-font td {
        font-size: 12px;
    }
</style>

<div>
    <h4>Transaction Reversal Requests</h4>
    
    <table class="table table-striped table-small-font table-condensed table-hover">
        <thead>
            <tr>
                <th colspan="2">Date</th>
                <th>Entered By</th>
                <th>For Student</th>
                <th style="text-align: right;">Amount (GHC)</th>
                <th style="text-align: center;">Revert Actions</th>
            </tr>
        </thead>
        
        <tbody>
            <?php $count = 1; foreach($revert_requests as $request) { ?>
            <tr>
                <td style="text-align: right; width: 20px;"><?php echo $count++ . "."; ?></td>
                <td><?php echo date('d M y - h:ia', strtotime($request['Transaction']['created'])); ?></td>
                <td><?php echo $request['BankUser']['fname']; ?></td>
                <td><?php echo $request['StudentUser']['fname'] . ' ' . $request['StudentUser']['fname']; ?></td>
                <td style="text-align: right;"><?php echo number_format($request['TransactionBankDetail'][0]['credit_amt'], 2); ?></td>
                <td style="text-align: center;">
                    <a href="<?php echo $this->Html->url(array('action' => 'revert_approve', $request['Transaction']['id'])); ?>" class="btn btn-mini btn-success approve_btn">Approve</a>
                    <a href="<?php echo $this->Html->url(array('action' => 'revert_cancel', $request['Transaction']['id'])); ?>" class="btn btn-mini btn-danger cancel_btn">Cancel</a>
                </td>
            </tr>
            <?php } ?>
        </tbody>
    </table>
</div>

<!--<div style="padding: 20px; margin-bottom: 50px;">
    <i class="icon icon-question-sign icon-3x pull-left"></i>
    <p>Welcome to your student payments Dashboard. With this portal you will be able to make payments for various services on the platform</p>
</div>-->

<!--<h3>Notifications</h3>
<?php
//debug($notifications);
if($notifications){
    foreach($notifications as $notify){
        $id = $notify['StudentNotification']['id'];
        $title = $notify['StudentNotification']['notify_title'];
        $msg = $notify['StudentNotification']['notify_msg'];
        echo "<div class='notify-wrapper' data-id=$id>".$this->Message->msg($title,$msg,'success', true)."</div>";
    }
}
else{
    echo $this->Message->msg('Notification','You have no notifications','warning', true);
}
?>
<input type="hidden" id="delete_notification" value="<?php echo $this->Html->url(array('controller' => 'Student', 'action' => 'deleteNotification')); ?>" />
-->


<script type="text/javascript">
    $("div.notify-wrapper > div.alert > a").click(function(){
        var id = $(this).parent().parent().attr('data-id');
        var url = $('#delete_notification').val()+'/'+id;
        var query = '';
        $.post(url, query, function (response) {

        },'json');
       //alert(id);
    });
    
    var transactions = {
        
        init: function() {
            $(".approve_btn").click(function(e) {
                e.preventDefault();
                
                if( confirm('You are about APPROVE this revert request and debit the student account by the amount paid.') ) {
                    
                }
            });
            
            $(".cancel_btn").click(function(e) {
                e.preventDefault();
                
                if( confirm('You are about CANCEL this revert request and maintain the transaction status as is.') ) {
                    
                }
            });
        }
    };
    
    $(document).ready(function() {
        transactions.init();
    });
</script>